<template>
  <the-header/>
  <a-layout>
    <a-layout-content
        :style="{ background: '#fff', padding: '24px', margin: 0, minHeight: '280px' }">
    </a-layout-content>
    <the-footer/>
  </a-layout>
  <the-footer/>
</template>

<script lang="ts">
import { defineComponent,onMounted } from 'vue';
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src
import axios from 'axios';
import {message} from "ant-design-vue";
import router from "@/router";
import theHeader from '@/components/the-header.vue';
import theFooter from '@/components/the-footer.vue';
export default defineComponent({
  name: 'Home',
  components: {
    HelloWorld,
    theFooter,
    theHeader
  },
  setup(){
    console.log("set up");

    onMounted(()=>{
      console.log("OnMounted");
      axios.get("api/user/test").then(
          (response) =>{
             //const data = response.data;
            //console.log(response.data)
            //console.log("错误码",response.data.errorCode)

            if(response.data.errorCode == 2001){
              message.error("你还没登陆");
              router.push("/Login")
            }else if(response.data.errorCode == 3001){
              message.error("你没有权限");
              router.push("/Login")
            }
          }
      )
    })
  }
});
</script>
